<template>

    <div class="brand-wrapper">
        <!--      查询表单 -->
        <div class="search-form">
            <el-form :inline="true" class="demo-form-inline" size="mini">
                <el-form-item label="赠品名称">
                    <el-input placeholder="请输入赠品名称" v-model="searchParams.giftsName"></el-input>
                </el-form-item>

                <el-form-item label="选择类型">
                    <!--动态渲染  选择品牌-->
                    <el-select placeholder="选择类型" v-model="searchParams.productId">
                        <el-option v-for="(item,index) in modelList" :key="index" :label="item.productModel"
                                   :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="选择品牌">
                    <!--动态渲染  选择品牌-->
                    <el-select placeholder="选择品牌" v-model="formData.brandId">
                        <el-option v-for="(item,index) in brandList" :key="index" :label="item.brandName"
                                   :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <!--        <el-form-item label="活动区域">-->
                <el-form-item>
                    <el-button type="primary" @click="searchPage1">查询</el-button>
                    <el-button type="warning" @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>


        <!--    表格数据-->
        <!--:tree-props="{children: 'children'
            row-key="id"
         树状结构 children-->
        <div class="data-box">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    @selection-change="selectChange">
                <el-table-column
                        align="center"
                        type="selection"
                        width="55">
                </el-table-column>

                <el-table-column type="expand">
                    <template slot-scope="props">
                        <el-form label-position="left" inline class="demo-table-expand">
                            <el-form-item label="赠品名称">
                                <span>{{ props.row.giftsName }}</span>
                            </el-form-item>
                            <el-form-item label="赠品类型">
                                <span>{{ props.row.typeId }}</span>
                            </el-form-item>
                            <el-form-item label="赠品型号">
                                <span>{{ props.row.productId }}</span>
                            </el-form-item>
                            <el-form-item label="赠品单价">
                                <span>{{ props.row.sellPrice }}</span>
                            </el-form-item>
                            <el-form-item label="采购成本">
                                <span>{{ props.row.buyPrice }}</span>
                            </el-form-item>
                            <el-form-item label="采购部门">
                                <span>{{ props.row.buyDepartment }}</span>
                            </el-form-item>
                            <el-form-item label="转换数量">
                                <span>{{ props.row.giftsNumber }}</span>
                            </el-form-item>
                            <el-form-item label="赠品颜色">
                                <span>{{ props.row.giftsColor }}</span>
                            </el-form-item>
                        </el-form>
                    </template>
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="id"
                        label="序号">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="giftsName"
                        label="赠品名称">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="productId"
                        label="商品类型">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="brandId"
                        label="品牌名称">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="sellPrice"
                        label="赠品单价">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="giftsNumber"
                        label="转换数量">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="buyPrice"
                        label="购买成本">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="approveStatus"
                        label="审核状态">
                </el-table-column>
                <el-table-column
                        label="操作"
                        width="350">
                    <template v-slot="hanjie">
                        <el-button type="primary" size="mini" icon="el-icon-edit"
                                   @click="dialogVisible=true,formData.id=hanjie.row.id,findById()"></el-button>
                        <el-button type="primary" size="mini"
                                   @click="dialogVisible3=true,formData=hanjie.row">审核
                        </el-button>
                        <el-popconfirm
                                confirm-button-text='确定'
                                cancel-button-text='取消'
                                icon="el-icon-info"
                                icon-color="red"
                                @confirm="deleteById"
                                placement="top"
                                title="是否要删除本条记录？"
                        >
                            <el-button slot="reference" type="danger" size="mini" @click="formData.id=hanjie.row.id"
                                       icon="el-icon-delete"></el-button>
                        </el-popconfirm>
                    </template>
                </el-table-column>
            </el-table>

        </div>


        <!--    分页-->
        <div class="page-box">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    :total="total"
                    :page-size="searchParams.pageSize"
                    :current-page="searchParams.currentPage"
                    @current-change="currentPageChange"
            >
            </el-pagination>

        </div>

        <!--新增审核跟踪的弹窗-->
        <!--弹框-->
        <el-dialog
                title="实体操作"
                :visible.sync="dialogVisible3"
                width="70%"
        >
            <el-form ref="form" label-width="80px" :model="formData" size="small">
                <el-tabs v-model="activeName">
                    <!--element ui 的 Tabs 标签页 -->
                    <el-form-item label="序号">
                        <el-input v-model="formData.id" ></el-input>
                    </el-form-item>
                    <el-form-item label="审批人">
                        <el-input v-model="formData.approveName"></el-input>
                    </el-form-item>

                    <el-form-item label="审批时间">
                        <el-date-picker
                                v-model="formData.approveTime"
                                type="date"
                                placeholder="审批时间">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="审批意见">
                        <el-input v-model="formData.approveComment"></el-input>
                    </el-form-item>

                </el-tabs>
            </el-form>
            <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible3 = false">取消</el-button>
        <el-button type="primary" size="mini" @click="dialogVisible3 = false,updateEntity1(),addGiftsEntity1()">审核通过</el-button>
        <el-button type="primary" size="mini" @click="dialogVisible3 = false,updateEntity2(),addGiftsEntity2()">审核不通过</el-button>
  </span>

        </el-dialog>


    </div>

</template>

<script>
    import gift from "./index";

    export default gift;
</script>

<!--src 引用css样式-->
<style src="./index.scss" lang="scss"></style>